﻿// Action script...

// [Action in Frame 1]
max_h = 8;
b0 = drop_mc.b0;
b1 = drop_mc.b1;
var getCountry_xml = new XML();
getCountry_xml.ignoreWhite = true;
getCountry_xml.load(_global.mainPath + "get_country.php");
getCountry_xml.onLoad = function (success)
{
    if (success)
    {
        trace ("xml loaded succesully");
        getCountryXML = this.firstChild.childNodes;
        _global.ctotal = getCountryXML.length;
        for (a = 0; a < getCountryXML.length; a++)
        {
            if (a == 0)
            {
                drop_mc.mc.cont.txt.text = getCountryXML[a].attributes.name;
            } // end if
            duplicateMovieClip(drop_mc.mc.cont, "cont" + a, drop_mc.mc.getNextHighestDepth());
            drop_mc.mc["cont" + a]._y = drop_mc.mc.cont._height * a;
            drop_mc.mc["cont" + a].txt.text = getCountryXML[a].attributes.name;
            drop_mc.mc["cont" + a].n = getCountryXML[a].attributes.name;
            drop_mc.mc["cont" + a].m = getCountryXML[a].attributes.id;
            drop_mc.mc["cont" + a].btn.onRelease = function ()
            {
                trace (this._parent.n);
                holder = this._parent._parent._parent._parent.country_txt;
                holder.text = this._parent.n;
                _root.country_id = this._parent.m;
                trace (_root.country_id);
                if (drop_mc._visible == 1)
                {
                    drop_mc._visible = 0;
                }
                else
                {
                    drop_mc._visible = 1;
                } // end else if
            };
            drop_mc.mask_mc._height = drop_mc.mc.cont._height * max_h;
            drop_mc.b0._y = 0;
            drop_mc.b1._y = drop_mc.mc.cont._height * max_h;
            cHeight = drop_mc.mc.cont._height;
            cEnd = cHeight * max_h;
            b0.onPress = function ()
            {
                gs.TweenMax.killTweensOf(drop_mc.mc, 1);
                if (drop_mc.mc._y < -cHeight)
                {
                    n = drop_mc.mc._y + drop_mc.mc.cont._height * max_h;
                    gs.TweenMax.to(drop_mc.mc, 1, {_y: n, ease: gs.easing.Strong.easeOut});
                }
                else
                {
                    gs.TweenMax.killTweensOf(drop_mc.mc, 1);
                    gs.TweenMax.to(drop_mc.mc, 1, {_y: 0, ease: gs.easing.Strong.easeOut});
                } // end else if
            };
            b1.onPress = function ()
            {
                gs.TweenMax.killTweensOf(drop_mc.mc, 1);
                if (drop_mc.mc._y > -cHeight * _global.ctotal + cEnd)
                {
                    n = drop_mc.mc._y - drop_mc.mc.cont._height * max_h;
                    gs.TweenMax.to(drop_mc.mc, 1, {_y: n, ease: gs.easing.Strong.easeOut});
                } // end if
            };
            drop_mc._visible = false;
            btnExpand.onRelease = function ()
            {
                if (drop_mc._visible == 1)
                {
                    drop_mc._visible = 0;
                }
                else
                {
                    drop_mc._visible = 1;
                } // end else if
            };
        } // end of for
    }
    else
    {
        trace ("Problem parsing XML.");
    } // end else if
};
